<template>
    <div class="box">
        <header class="header">
            <NavBar title="收获地址" />
        </header>
        <main class="content">
            <van-address-list v-model="chosenAddressId" :list="store.addressList" @select="onSelect" />
        </main>
    </div>
</template>
<script setup>
import NavBar from '@/components/NavBar.vue';
import { useCounterStore } from '@/stores/counter'
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import { onMounted } from 'vue'
const store = useCounterStore()
const router = useRouter()
const chosenAddressId = ref('1')
const onSelect = (item) => {
    store.changeisChecked(item.id)
    router.back()
}
onMounted(() => {
    chosenAddressId.value = store.checkedAddress.id
})
</script>